﻿using Castle.MicroKernel.Registration;
using Omu.Encrypto;
using Uber.Core.Repository;
using Uber.Core.Security;
using Uber.Core.Service;
using Uber.Data;
using Uber.Infra;
using Uber.Service;

namespace Uber.WebUI
{
    public class WindsorConfigurator
    {
        public static void Configure()
        {
            IoC.Container.Register(Component.For<Db>().LifeStyle.PerWebRequest);
            WindsorRegistrar.Register(typeof(IConnectionFactory), typeof(ConnectionFactory));
            WindsorRegistrar.Register(typeof(ISmtpServerConfig), typeof(SmtpServerConfig));
            WindsorRegistrar.Register(typeof(IFormsAuthentication), typeof(FormAuths));
            WindsorRegistrar.Register(typeof(IHasher), typeof(Hasher));

            WindsorRegistrar.RegisterAllFromAssemblies("Uber.Data");
            WindsorRegistrar.RegisterAllFromAssemblies("Uber.Service");
            WindsorRegistrar.RegisterSingleton(typeof(IRepo<>),typeof(Repo<>),"sr");
        }
    }
}